<extend name="work/base"/>
<block name="content">
    <header class="wx-header">
        <h1 class="wx-title">市属高速路况</h1>
    </header>
    <volist name="list" id="info">
        <div class="weui-form-preview">
            <div class="weui-form-preview__hd">
                <label class="weui-form-preview__label">高速名称</label>
                <em class="weui-form-preview__value">{$info.groups_name}</em>
            </div>
            <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">状态</label>
                    <span class="weui-form-preview__value">
                         <switch $info.status_road>
                        <case 1>
                        <i class="weui-icon-success"></i>
                        </case>
                        <case 3>
                        <i class="weui-icon-warn " style="color: #ffbe00;"></i>
                        </case>
                        <case 2>
                        <i class="weui-icon-warn " ></i>
                        </case>
                        <default />
                        </switch>
                        {$info.status_name}
                    </span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">详情</label>
                    <span class="weui-form-preview__value">{$info.info}</span>
                </div>

            </div>
            <div class="weui-form-preview__ft">
                <button type="submit" class="weui-form-preview__btn weui-form-preview__btn_primary"
                        road_id="{$info.groups_road}">
                    <eq name="info['order']" value="1">取消订阅高速路况<else/>订阅高速路况</eq>

                </button>
            </div>
        </div>
        <br>
    </volist>
    <img src="/weixin.jpg" style="width: 100%">

</block>
<block name="script">
    <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $.ajax({
                cache: false,
                type: "POST",
                url: '{:Url("cityroad/get_wxjs")}',
                data: {url: encodeURIComponent(location.href.split('#')[0])},
                async: false,
                error: function (request) {

                },
                success: function (data) {

                    data = eval("(" + data + ")");
                    wx.config({
                        debug: false,
                        appId: data.appid,
                        timestamp: data.timestamp,
                        nonceStr: data.noncestr,
                        signature: data.signature,
                        jsApiList: ['updateTimelineShareData', 'onMenuShareTimeline' ]
                    });

                }
            });
            wx.error(function (res) {

            });

            wx.ready(function () {      //需在用户可能点击分享按钮前就先调用
                wx.updateTimelineShareData({
                    title: '唐山市属高速路况', // 分享标题
                    link: "{:url('cityroad/index@jt.yooee.ltd')}", // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                    imgUrl: "https://jt.yooee.ltd/jtlogo.jpg", // 分享图标
                    success: function () {

                    },
                    fail:function(){

                    }
                })

            });

            $(".weui-form-preview__btn").click(function () {
                id = $(this).attr('road_id');
                location.href = '{:url("order")}' + '?id=' + id;
                return false;
            });


        });
    </script>
</block>
